package org.cpplib;

public class UtilClass {
    public static byte[] getFixLenBytes(String s, int length) {
        int fixLength = length  - s.getBytes().length;
        if(s.getBytes().length < length)
        {
            byte[] S_bytes = new byte[length];
            System.arraycopy(s.getBytes(), 0, S_bytes, 0, s.getBytes().length);
            for (int i = length - fixLength; i < length; i++) {
                S_bytes[i] = 0x00;

            }
            return S_bytes;
        }
        return s.getBytes();
    }
}
